package ogmios.processes;

import java.io.*;
import java.util.*;
import javax.swing.*;
import javax.swing.text.*;
import ogmios.core.*;

/**
 * A writer that simplifies writing text onto an outputstream
 */
public class DefaultOutputWriter
{
    private BufferedWriter out;

    public DefaultOutputWriter(OutputStream newOut)
    {

        out = new BufferedWriter(new OutputStreamWriter(newOut));

    }

    /**
     * Writes text onto output stream
     */
    public void write(String text)
    {


        try
        {
            out.write(text);
            out.flush();
        }
        catch (IOException ex)
        {
            OgmiosUtilities.showErrorBox(null, ex, "Process:Output Error");
        }

    }
}
